package com.upload.pic;

import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;

import com.act.BaseAct;
import com.xike.kyt.R;

public class UploadPhotoDetailAct extends BaseAct implements OnClickListener {

	ImageView imageView;
	int position;
	int tag = -1;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.act_upload_photodetail);

		Bundle bundle = getIntent().getExtras();
		if (bundle != null && bundle.containsKey("position")) {
			position = bundle.getInt("position");
		}
		if (bundle != null && bundle.containsKey("tag")) {
			tag = bundle.getInt("tag");
		}
		initViews();
	}

	@Override
	protected void initViews() {
		imageView = (ImageView) findViewById(R.id.photo_img);
		if (tag == 1) {
			imageView.setImageBitmap(Bimp.bmp2.get(position));
		} else {
			imageView.setImageBitmap(Bimp.bmp.get(position));
		}

		findViewById(R.id.layoutTitle_btn_back).setOnClickListener(this);
		findViewById(R.id.photo_tv_delete).setOnClickListener(this);
	}

	@Override
	protected void updateViews() {

	}

	@Override
	public void onClick(View v) {
		switch (v.getId()) {
		case R.id.layoutTitle_btn_back:
			finish();
			break;
		case R.id.photo_tv_delete:
			if (tag == 1) {
				Bimp.removeBitmap2(position);
			} else {
				Bimp.removeBitmap(position);
			}
			finish();
			break;

		default:
			break;
		}
	}

}
